/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * @brief map-messenger /map-messenger/include/Crypto.h
 * Copyright (C) Matheus Neder, Amanda Duarte, Priscila Cardoso 2010
 * 
 * Crypto.h is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Crypto.h is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * @brief map-messenger /map-messenger/include/Crypto.h
 * @file Crypto.h
 * @date 17/06/2010
 * @author Matheus Neder <matheusneder@gmail.com>
 * @author Amanda Duarte <mandinhaduarte89@gmail.com>
 * @author Priscila Cardoso <japinha-htinha@hotmail.com>
 */

#ifndef CRYPTO_H_
#define CRYPTO_H_

#include <cstring>
#include "MapInteger.h"
#include <stdexcept>
#include <cstdlib>

class Crypto
{
	MapInteger key;
	size_t keyLen;
public:
	explicit Crypto(MapInteger key);
//	:
//		key(key)
//	{
//		keyLen = sizeof(key);
//	}
	char* transform(const char* data, size_t len)
			throw (std::runtime_error);
//	{
//		if ((len % keyLen) != 0)
//		{
//			throw std::runtime_error(
//					"Crypto::transform: Tamanho de dados incompativel c/ a chave!");
//		}
//		size_t blockLen = len / keyLen;
//		MapInteger* rawData = (MapInteger*) ((void*) data);
//		MapInteger* transformedData = new MapInteger[blockLen];
//		for (size_t i = 0; i < blockLen; i++)
//		{
//			transformedData[i] = (rawData[i]) ^ key;
//		}
//		return ((char*)(void*)transformedData);
//	}
};

#endif /* CRYPTO_H_ */
